<template>
  <div class="page">
    <el-card>
      <div slot="header" class="clearfix">
        <span>项目导出</span>
      </div>
      <el-form :inline="true"  class="demo-form-inline">
        <el-form-item>
          <el-button :disabled="down" type="primary" @click="downall">{{rar}}</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  data() {
    return {
      rar: "导出项目附件",
      down: false,
      api: process.env.API_ROOT,
    };
  },
  components: {},
  methods: {
    downall() {
      this.down = true;
      this.rar = "正在获取数据...";
      this.$http.get("/filing/file/zip/get").then(res => {
        if (res.data.success === true) {
          this.rar = "导出项目附件";
          window.location.href = `${this.api}/temp/fujian.zip`
          // window.open('http://filing.dival.cn/temp/fujian.zip')
          // this.$http.get("/temp/fujian.zip", {
          //   onDownloadProgress: progressEvent => {
          //     console.log(progressEvent);
          //     this.rar = progressEvent.loaded / 1024 / 1024;
          //     this.rar = "正在下载中，请等待。。。" + this.rar.toFixed(2) + "M";
          //   }
          // });
        }
      });
    }
  }
};
</script>

<style scoped lang="scss">
// @import './index.scss';
</style>
